<div id="network-supply-service-bar2" style="height: 100%">

</div>

<script type="text/javascript">
    $(function () {
        loadbar2();
        $("select#prjId").change(function(){
            $("#loading").show();
            loadbar2();
        });
    });
    function loadbar2() {
        var center=$("#prjId").val();
        $.ajax({
            url: "#springUrl('/network/supply/service/bar2')",
            data: {"center": center},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var myChart = echarts.init(document.getElementById('network-supply-service-bar2'), 'macarons');
                    option = {
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'cross',
                                crossStyle: {
                                    color: '#999'
                                }
                            }
                        },
                        toolbox: {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'cross',
                                crossStyle: {
                                    color: '#998492'
                                }
                            },
                        },
                        grid:{
                            left: '3%',
                            right: '4%',
                            bottom: '5%',
                            top:'5%',
                            containLabel: true
                        },
                        xAxis: [
                            {
                                type: 'category',
                                data: d.data.x1,
                                axisLabel:{
                                    show:true,
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                            }
                        ],
                        yAxis: [
                            {
                                type: 'value',
                                //name: '订单量',
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                                axisLabel: {
                                    formatter: function(value){
                                        var var1=value*1;
                                        return var1;
                                    },
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                splitLine:{
                                    show:true
                                },
                                splitArea: {
                                    show:true,
                                    areaStyle: {
                                        color: ['rgba(0,0,0,0)', 'rgba(0,0,0,0)']
                                    }
                                },
                            },
                            {
                                type: 'value',
                               // name: '频次',
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                                axisLabel: {
                                    formatter: function(value){
                                        var var1=value*1;
                                        return var1;
                                    },
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                splitLine:{
                                    show:false
                                },
                                splitArea: {
                                    show: true,
                                    areaStyle: {
                                        color: ['rgba(0,0,0,0)', 'rgba(0,0,0,0)']
                                    }
                                },
                            }
                        ],
                        series: [
                            {
                                name:'完成率',
                                type:'bar',
                                data:d.data.x2,
                                barWidth:20,
                                markLine: {
                                    data: [
                                        {type: 'average', name: '平均值'}
                                    ]
                                },
                                itemStyle: {
                                    normal: {
                                        color: function(params) {
                                            // build a color map as your need.
                                            var colorList = [
                                                '#4472c4','#9BCA63','#FAD860','#F3A43B','#60C0DD',
                                                '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0',
                                                '#0fa99d','#d9d9d9','#787473','#c9eee7','#e7a14c',
                                            ];
                                            return colorList[params.dataIndex]
                                        },
                                    },
                                    //以下为是否显示，显示位置和显示格式的设置了
                                }
                            },
                        ]
                    };
                    myChart.setOption(option);
                    $("#loading").hide();
                }
            }
        });
    }

</script>